package com.syher.quartz;

import com.syher.quartz.core.config.pool.monitor.ThreadPoolMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@EnableAutoConfiguration
@ComponentScan(basePackages = {
        "com.syher.quartz.core.config",
        "com.syher.quartz.task"
})
public class SpringBootQuartzApplication implements CommandLineRunner {

    private static final Logger logger = LoggerFactory.getLogger(SpringBootQuartzApplication.class);

    @Autowired
    ThreadPoolMonitor monitor;

    public static void main(String[] args) {
        SpringApplication.run(SpringBootQuartzApplication.class, args);
    }

    @Override
    public void run(String... strings) throws Exception {
        logger.info("spring boot quartz started.");
        new Thread(monitor).start();
    }
}
